#include "Role.h"
#include<QPainter>

Role::Role(QObject *parent) : QObject(parent)
{
    mRow=1;
    mCol=1;
    mImg=QImage("://imag/peo1.png");
    //显示位置
    mPaintPos=QPoint(mCol,mRow)*64;

}
void Role::Move(int _dRow,int _dCol)
{
    mRow += _dRow;
    mCol += _dCol;
    switch(_dRow)
    {
    case  1:
            mImg=QImage("://imag/peo1.png");
        break;
    case -1:
            mImg=QImage("://imag/peo3.png");
    default:
        break;
    }
    switch (_dCol) {
    case 1:
        mImg=QImage("://imag/peo4.png");
        break;
    case -1:
        mImg=QImage("://imag/peo2.png");
    default:
        break;
    }
    mPaintPos = QPoint(mCol,mRow)*64;
}
void Role::Paint(QPainter* _p,QPoint _pos)
{
    _p->drawImage(mPaintPos + _pos,mImg);

}
